import { clients } from "./ws.js"
type Event = {
    user_id: string
    user_name: string
    message: string
    msg: string
    reply: (msg: string) => void
}
/**
 * 构造e
 * @param msg 
 */
export function makeEvent(msg: string): Event {
    return {
        user_id: '12345678',
        user_name: 'admin',
        message: msg,
        msg: msg,
        reply: function (msg: string) {
            if (clients.panel) {
                clients.panel.send(JSON.stringify({
                    type: 'message',
                    data: msg
                }))
            }
        }
    }
}